package main

import "strconv"

func taskAdd(deviceID, pName, tType, extra string) {
	var task = Task{}
	task.DeviceID = deviceID
	task.PName = pName
	task.Type, _ = strconv.Atoi(tType)
	task.Status = TaskUnStart
	task.Extra = extra
	db.Create(&task)

	if device := monitor.getDevice(deviceID); device != nil {
		device.ch <- task
	}
}
